<template>
  <div></div>
</template>
<script>
import { bus } from '@/main.js';
import { mapState, mapMutations } from 'vuex';
export default {
  name: 'download',
  mixins: [], //混入
  components: {}, //组件
  props: {}, //集成属性
  data() {
    return {};
  },
  computed: {
    ...mapState([]),
  },
  methods: {
    ...mapMutations([]),
    exportFile: function(json) {
      let content = JSON.stringify(this.listQA);
      let blob = new Blob([content], {
        type: 'text/plain;charset=utf-8',
      });
      let url = URL.createObjectURL(blob);
      this.downloadFile(url, 'data.json');
      URL.revokeObjectURL(url); //释放资源
    },
    downloadFile: function(fileUrl, fileName) {
      let a = document.createElement('a');
      a.href = fileUrl;
      a.download = fileName;
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
    },
  },
};
</script>
<style lang="less" scoped></style>
